home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Editions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  15.1 KB  |  472 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Editions.h
  3.  
  4.      Contains:    Edition Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1989-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __EDITIONS__
  19. #define __EDITIONS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27. #ifndef __FILES__
  28. #include <Files.h>
  29. #endif
  30. #ifndef __ALIASES__
  31. #include <Aliases.h>
  32. #endif
  33. #ifndef __DIALOGS__
  34. #include <Dialogs.h>
  35. #endif
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59.  
  60. enum {
  61.                                                                 /* resource types  */
  62.     rSectionType                = FOUR_CHAR_CODE('sect'),        /* ResType of saved SectionRecords */
  63.                                                                 /* Finder types for edition files */
  64.     kPICTEditionFileType        = FOUR_CHAR_CODE('edtp'),
  65.     kTEXTEditionFileType        = FOUR_CHAR_CODE('edtt'),
  66.     ksndEditionFileType            = FOUR_CHAR_CODE('edts'),
  67.     kUnknownEditionFileType        = FOUR_CHAR_CODE('edtu'),
  68.     kPublisherDocAliasFormat    = FOUR_CHAR_CODE('alis'),
  69.     kPreviewFormat                = FOUR_CHAR_CODE('prvw'),
  70.     kFormatListFormat            = FOUR_CHAR_CODE('fmts')
  71. };
  72.  
  73.  
  74. enum {
  75.                                                                 /* section types */
  76.     stSubscriber                = 0x01,
  77.     stPublisher                    = 0x0A
  78. };
  79.  
  80.  
  81. enum {
  82.     sumAutomatic                = 0,                            /* subscriber update mode - Automatically     */
  83.     sumManual                    = 1,                            /* subscriber update mode - Manually */
  84.     pumOnSave                    = 0,                            /* publisher update mode - OnSave            */
  85.     pumManual                    = 1                                /* publisher update mode - Manually */
  86. };
  87.  
  88.  
  89. enum {
  90.     kPartsNotUsed                = 0,
  91.     kPartNumberUnknown            = -1
  92. };
  93.  
  94.  
  95. enum {
  96.     kPreviewWidth                = 120,
  97.     kPreviewHeight                = 120
  98. };
  99.  
  100.  
  101. enum {
  102.                                                                 /* bits for formatsMask */
  103.     kPICTformatMask                = 1,
  104.     kTEXTformatMask                = 2,
  105.     ksndFormatMask                = 4
  106. };
  107.  
  108.  
  109.  
  110. enum {
  111.                                                                 /* pseudo-item hits for dialogHooks the first is for NewPublisher or NewSubscriber Dialogs */
  112.     emHookRedrawPreview            = 150,                            /* the following are for SectionOptions Dialog */
  113.     emHookCancelSection            = 160,
  114.     emHookGoToPublisher            = 161,
  115.     emHookGetEditionNow            = 162,
  116.     emHookSendEditionNow        = 162,
  117.     emHookManualUpdateMode        = 163,
  118.     emHookAutoUpdateMode        = 164
  119. };
  120.  
  121.  
  122.  
  123. enum {
  124.                                                                 /* the refcon field of the dialog record during a modalfilter or dialoghook contains one the following */
  125.     emOptionsDialogRefCon        = FOUR_CHAR_CODE('optn'),
  126.     emCancelSectionDialogRefCon    = FOUR_CHAR_CODE('cncl'),
  127.     emGoToPubErrDialogRefCon    = FOUR_CHAR_CODE('gerr')
  128. };
  129.  
  130.  
  131. enum {
  132.     kFormatLengthUnknown        = -1
  133. };
  134.  
  135. /* one byte, stSubscriber or stPublisher */
  136. typedef SignedByte                         SectionType;
  137. /* seconds since 1904 */
  138. typedef unsigned long                     TimeStamp;
  139. /* similar to ResType */
  140. typedef FourCharCode                     FormatType;
  141. /* used in Edition I/O */
  142. typedef Handle                             EditionRefNum;
  143. /* update modes */
  144. /* sumAutomatic, pumSuspend, etc */
  145. typedef short                             UpdateMode;
  146. typedef struct SectionRecord             SectionRecord;
  147. typedef SectionRecord *                    SectionPtr;
  148. typedef SectionPtr *                    SectionHandle;
  149. struct SectionRecord {
  150.     SignedByte                         version;                    /* always 0x01 in system 7.0 */
  151.     SectionType                     kind;                        /* stSubscriber or stPublisher */
  152.     UpdateMode                         mode;                        /* auto or manual */
  153.     TimeStamp                         mdDate;                        /* last change in document */
  154.     long                             sectionID;                    /* app. specific, unique per document */
  155.     long                             refCon;                        /* application specific */
  156.     AliasHandle                     alias;                        /* handle to Alias Record */
  157.     long                             subPart;                    /* which part of container file */
  158.     SectionHandle                     nextSection;                /* for linked list of app's Sections */
  159.     Handle                             controlBlock;                /* used internally */
  160.     EditionRefNum                     refNum;                        /* used internally */
  161. };
  162.  
  163. struct EditionContainerSpec {
  164.     FSSpec                             theFile;
  165.     ScriptCode                         theFileScript;
  166.     long                             thePart;
  167.     Str31                             thePartName;
  168.     ScriptCode                         thePartScript;
  169. };
  170. typedef struct EditionContainerSpec EditionContainerSpec;
  171.  
  172. typedef EditionContainerSpec *            EditionContainerSpecPtr;
  173. struct EditionInfoRecord {
  174.     TimeStamp                         crDate;                        /* date EditionContainer was created */
  175.     TimeStamp                         mdDate;                        /* date of last change */
  176.     OSType                             fdCreator;                    /* file creator */
  177.     OSType                             fdType;                        /* file type */
  178.     EditionContainerSpec             container;                    /* the Edition */
  179. };
  180. typedef struct EditionInfoRecord EditionInfoRecord;
  181.  
  182. struct NewPublisherReply {
  183.     Boolean                         canceled;                    /* O */
  184.     Boolean                         replacing;
  185.     Boolean                         usePart;                    /* I */
  186.     SInt8                             filler;
  187.     Handle                             preview;                    /* I */
  188.     FormatType                         previewFormat;                /* I */
  189.     EditionContainerSpec             container;                    /* I/O */
  190. };
  191. typedef struct NewPublisherReply NewPublisherReply;
  192.  
  193. struct NewSubscriberReply {
  194.     Boolean                         canceled;                    /* O */
  195.     SignedByte                         formatsMask;
  196.     EditionContainerSpec             container;                    /*I/O*/
  197. };
  198. typedef struct NewSubscriberReply NewSubscriberReply;
  199.  
  200. struct SectionOptionsReply {
  201.     Boolean                         canceled;                    /* O */
  202.     Boolean                         changed;                    /* O */
  203.     SectionHandle                     sectionH;                    /* I */
  204.     ResType                         action;                        /* O */
  205. };
  206. typedef struct SectionOptionsReply SectionOptionsReply;
  207.  
  208. typedef CALLBACK_API( Boolean , ExpModalFilterProcPtr )(DialogPtr theDialog, EventRecord *theEvent, short itemOffset, short *itemHit, Ptr yourDataPtr);
  209. typedef CALLBACK_API( short , ExpDlgHookProcPtr )(short itemOffset, short itemHit, DialogPtr theDialog, Ptr yourDataPtr);
  210. typedef STACK_UPP_TYPE(ExpModalFilterProcPtr)                     ExpModalFilterUPP;
  211. typedef STACK_UPP_TYPE(ExpDlgHookProcPtr)                         ExpDlgHookUPP;
  212. enum { uppExpModalFilterProcInfo = 0x0000FBD0 };                 /* pascal 1_byte Func(4_bytes, 4_bytes, 2_bytes, 4_bytes, 4_bytes) */
  213. enum { uppExpDlgHookProcInfo = 0x00003EA0 };                     /* pascal 2_bytes Func(2_bytes, 2_bytes, 4_bytes, 4_bytes) */
  214. #define NewExpModalFilterProc(userRoutine)                         (ExpModalFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppExpModalFilterProcInfo, GetCurrentArchitecture())
  215. #define NewExpDlgHookProc(userRoutine)                             (ExpDlgHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppExpDlgHookProcInfo, GetCurrentArchitecture())
  216. #define CallExpModalFilterProc(userRoutine, theDialog, theEvent, itemOffset, itemHit, yourDataPtr)  CALL_FIVE_PARAMETER_UPP((userRoutine), uppExpModalFilterProcInfo, (theDialog), (theEvent), (itemOffset), (itemHit), (yourDataPtr))
  217. #define CallExpDlgHookProc(userRoutine, itemOffset, itemHit, theDialog, yourDataPtr)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppExpDlgHookProcInfo, (itemOffset), (itemHit), (theDialog), (yourDataPtr))
  218.  
  219. enum {
  220.     ioHasFormat                    = 0,
  221.     ioReadFormat                = 1,
  222.     ioNewFormat                    = 2,
  223.     ioWriteFormat                = 3
  224. };
  225.  
  226. typedef SignedByte                         FormatIOVerb;
  227.  
  228. enum {
  229.     eoOpen                        = 0,
  230.     eoClose                        = 1,
  231.     eoOpenNew                    = 2,
  232.     eoCloseNew                    = 3,
  233.     eoCanSubscribe                = 4
  234. };
  235.  
  236. typedef SignedByte                         EditionOpenerVerb;
  237. struct FormatIOParamBlock {
  238.     long                             ioRefNum;
  239.     FormatType                         format;
  240.     long                             formatIndex;
  241.     unsigned long                     offset;
  242.     Ptr                             buffPtr;
  243.     unsigned long                     buffLen;
  244. };
  245. typedef struct FormatIOParamBlock FormatIOParamBlock;
  246.  
  247. typedef struct EditionOpenerParamBlock     EditionOpenerParamBlock;
  248. typedef CALLBACK_API( short , FormatIOProcPtr )(FormatIOVerb selector, FormatIOParamBlock *PB);
  249. typedef CALLBACK_API( short , EditionOpenerProcPtr )(EditionOpenerVerb selector, EditionOpenerParamBlock *PB);
  250. typedef STACK_UPP_TYPE(FormatIOProcPtr)                         FormatIOUPP;
  251. typedef STACK_UPP_TYPE(EditionOpenerProcPtr)                     EditionOpenerUPP;
  252. struct EditionOpenerParamBlock {
  253.     EditionInfoRecord                 info;
  254.     SectionHandle                     sectionH;
  255.     const FSSpec *                    document;
  256.     OSType                             fdCreator;
  257.     long                             ioRefNum;
  258.     FormatIOUPP                     ioProc;
  259.     Boolean                         success;
  260.     SignedByte                         formatsMask;
  261. };
  262.  
  263. enum { uppFormatIOProcInfo = 0x00000360 };                         /* pascal 2_bytes Func(1_byte, 4_bytes) */
  264. enum { uppEditionOpenerProcInfo = 0x00000360 };                 /* pascal 2_bytes Func(1_byte, 4_bytes) */
  265. #define NewFormatIOProc(userRoutine)                             (FormatIOUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFormatIOProcInfo, GetCurrentArchitecture())
  266. #define NewEditionOpenerProc(userRoutine)                         (EditionOpenerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppEditionOpenerProcInfo, GetCurrentArchitecture())
  267. /* 
  268.  Section events now arrive in the message buffer using the AppleEvent format.
  269.  The direct object parameter is an aeTemporaryIDParamType ('tid '). The temporary
  270.  ID's type is rSectionType ('sect') and the 32-bit value is a SectionHandle.
  271.  The following is a sample buffer
  272.  
  273.  name       offset     contents
  274.  ----       ------     --------
  275.  header           0      'aevt'
  276.  majorVersion     4      0x01
  277.  minorVersion     6      0x01
  278.  endOfMetaData     8      ';;;;' 
  279.  directObjKey     12  '----' 
  280.  paramType      16  'tid ' 
  281.  paramLength      20  0x0008 
  282.  tempIDType      24  'sect' 
  283.  tempID            28  the SectionHandle <-- this is want you want
  284. */
  285.  
  286.  
  287. enum {
  288.     sectionEventMsgClass        = FOUR_CHAR_CODE('sect'),
  289.     sectionReadMsgID            = FOUR_CHAR_CODE('read'),
  290.     sectionWriteMsgID            = FOUR_CHAR_CODE('writ'),
  291.     sectionScrollMsgID            = FOUR_CHAR_CODE('scrl'),
  292.     sectionCancelMsgID            = FOUR_CHAR_CODE('cncl')
  293. };
  294.  
  295.  
  296. enum {
  297.     currentEditionMgrVers        = 0x0011
  298. };
  299.  
  300.  
  301.  
  302. #if !TARGET_RT_MAC_CFM
  303. EXTERN_API( OSErr )
  304. InitEditionPack                    (void)                                                        FIVEWORDINLINE(0x3F3C, 0x0011, 0x303C, 0x0100, 0xA82D);
  305.  
  306. #else
  307. #define InitEditionPack() InitEditionPackVersion(currentEditionMgrVers)
  308. EXTERN_API( OSErr )
  309. InitEditionPackVersion            (short                     curEditionMgrVers)                    THREEWORDINLINE(0x303C, 0x0100, 0xA82D);
  310.  
  311. #endif  /*  !TARGET_RT_MAC_CFM */
  312.  
  313. EXTERN_API( OSErr )
  314. NewSection                        (const EditionContainerSpec * container,
  315.                                  ConstFSSpecPtr         sectionDocument,
  316.                                  SectionType             kind,
  317.                                  long                     sectionID,
  318.                                  UpdateMode             initalMode,
  319.                                  SectionHandle *        sectionH)                            THREEWORDINLINE(0x303C, 0x0A02, 0xA82D);
  320.  
  321. EXTERN_API( OSErr )
  322. RegisterSection                    (const FSSpec *            sectionDocument,
  323.                                  SectionHandle             sectionH,
  324.                                  Boolean *                aliasWasUpdated)                    THREEWORDINLINE(0x303C, 0x0604, 0xA82D);
  325.  
  326. EXTERN_API( OSErr )
  327. UnRegisterSection                (SectionHandle             sectionH)                            THREEWORDINLINE(0x303C, 0x0206, 0xA82D);
  328.  
  329. EXTERN_API( OSErr )
  330. IsRegisteredSection                (SectionHandle             sectionH)                            THREEWORDINLINE(0x303C, 0x0208, 0xA82D);
  331.  
  332. EXTERN_API( OSErr )
  333. AssociateSection                (SectionHandle             sectionH,
  334.                                  const FSSpec *            newSectionDocument)                    THREEWORDINLINE(0x303C, 0x040C, 0xA82D);
  335.  
  336. EXTERN_API( OSErr )
  337. CreateEditionContainerFile        (const FSSpec *            editionFile,
  338.                                  OSType                 fdCreator,
  339.                                  ScriptCode             editionFileNameScript)                THREEWORDINLINE(0x303C, 0x050E, 0xA82D);
  340.  
  341. EXTERN_API( OSErr )
  342. DeleteEditionContainerFile        (const FSSpec *            editionFile)                        THREEWORDINLINE(0x303C, 0x0210, 0xA82D);
  343.  
  344. EXTERN_API( OSErr )
  345. OpenEdition                        (SectionHandle             subscriberSectionH,
  346.                                  EditionRefNum *        refNum)                                THREEWORDINLINE(0x303C, 0x0412, 0xA82D);
  347.  
  348. EXTERN_API( OSErr )
  349. OpenNewEdition                    (SectionHandle             publisherSectionH,
  350.                                  OSType                 fdCreator,
  351.                                  ConstFSSpecPtr         publisherSectionDocument,
  352.                                  EditionRefNum *        refNum)                                THREEWORDINLINE(0x303C, 0x0814, 0xA82D);
  353.  
  354. EXTERN_API( OSErr )
  355. CloseEdition                    (EditionRefNum             whichEdition,
  356.                                  Boolean                 successful)                            THREEWORDINLINE(0x303C, 0x0316, 0xA82D);
  357.  
  358. EXTERN_API( OSErr )
  359. EditionHasFormat                (EditionRefNum             whichEdition,
  360.                                  FormatType             whichFormat,
  361.                                  Size *                    formatSize)                            THREEWORDINLINE(0x303C, 0x0618, 0xA82D);
  362.  
  363. EXTERN_API( OSErr )
  364. ReadEdition                        (EditionRefNum             whichEdition,
  365.                                  FormatType             whichFormat,
  366.                                  void *                    buffPtr,
  367.                                  Size *                    buffLen)                            THREEWORDINLINE(0x303C, 0x081A, 0xA82D);
  368.  
  369. EXTERN_API( OSErr )
  370. WriteEdition                    (EditionRefNum             whichEdition,
  371.                                  FormatType             whichFormat,
  372.                                  const void *            buffPtr,
  373.                                  Size                     buffLen)                            THREEWORDINLINE(0x303C, 0x081C, 0xA82D);
  374.  
  375. EXTERN_API( OSErr )
  376. GetEditionFormatMark            (EditionRefNum             whichEdition,
  377.                                  FormatType             whichFormat,
  378.                                  unsigned long *        currentMark)                        THREEWORDINLINE(0x303C, 0x061E, 0xA82D);
  379.  
  380. EXTERN_API( OSErr )
  381. SetEditionFormatMark            (EditionRefNum             whichEdition,
  382.                                  FormatType             whichFormat,
  383.                                  unsigned long             setMarkTo)                            THREEWORDINLINE(0x303C, 0x0620, 0xA82D);
  384.  
  385. EXTERN_API( OSErr )
  386. GetEditionInfo                    (SectionHandle             sectionH,
  387.                                  EditionInfoRecord *    editionInfo)                        THREEWORDINLINE(0x303C, 0x0422, 0xA82D);
  388.  
  389. EXTERN_API( OSErr )
  390. GoToPublisherSection            (const EditionContainerSpec * container)                    THREEWORDINLINE(0x303C, 0x0224, 0xA82D);
  391.  
  392. EXTERN_API( OSErr )
  393. GetLastEditionContainerUsed        (EditionContainerSpec *    container)                            THREEWORDINLINE(0x303C, 0x0226, 0xA82D);
  394.  
  395. EXTERN_API( OSErr )
  396. GetStandardFormats                (const EditionContainerSpec * container,
  397.                                  FormatType *            previewFormat,
  398.                                  Handle                 preview,
  399.                                  Handle                 publisherAlias,
  400.                                  Handle                 formats)                            THREEWORDINLINE(0x303C, 0x0A28, 0xA82D);
  401.  
  402. EXTERN_API( OSErr )
  403. GetEditionOpenerProc            (EditionOpenerUPP *        opener)                                THREEWORDINLINE(0x303C, 0x022A, 0xA82D);
  404.  
  405. EXTERN_API( OSErr )
  406. SetEditionOpenerProc            (EditionOpenerUPP         opener)                                THREEWORDINLINE(0x303C, 0x022C, 0xA82D);
  407.  
  408. EXTERN_API( OSErr )
  409. CallEditionOpenerProc            (EditionOpenerVerb         selector,
  410.                                  EditionOpenerParamBlock * PB,
  411.                                  EditionOpenerUPP         routine)                            THREEWORDINLINE(0x303C, 0x052E, 0xA82D);
  412.  
  413. EXTERN_API( OSErr )
  414. CallFormatIOProc                (FormatIOVerb             selector,
  415.                                  FormatIOParamBlock *    PB,
  416.                                  FormatIOUPP             routine)                            THREEWORDINLINE(0x303C, 0x0530, 0xA82D);
  417.  
  418. EXTERN_API( OSErr )
  419. NewSubscriberDialog                (NewSubscriberReply *    reply)                                THREEWORDINLINE(0x303C, 0x0232, 0xA82D);
  420.  
  421. EXTERN_API( OSErr )
  422. NewSubscriberExpDialog            (NewSubscriberReply *    reply,
  423.                                  Point                     where,
  424.                                  short                     expansionDITLresID,
  425.                                  ExpDlgHookUPP             dlgHook,
  426.                                  ExpModalFilterUPP         filter,
  427.                                  void *                    yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0B34, 0xA82D);
  428.  
  429. EXTERN_API( OSErr )
  430. NewPublisherDialog                (NewPublisherReply *    reply)                                THREEWORDINLINE(0x303C, 0x0236, 0xA82D);
  431.  
  432. EXTERN_API( OSErr )
  433. NewPublisherExpDialog            (NewPublisherReply *    reply,
  434.                                  Point                     where,
  435.                                  short                     expansionDITLresID,
  436.                                  ExpDlgHookUPP             dlgHook,
  437.                                  ExpModalFilterUPP         filter,
  438.                                  void *                    yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0B38, 0xA82D);
  439.  
  440. EXTERN_API( OSErr )
  441. SectionOptionsDialog            (SectionOptionsReply *    reply)                                THREEWORDINLINE(0x303C, 0x023A, 0xA82D);
  442.  
  443. EXTERN_API( OSErr )
  444. SectionOptionsExpDialog            (SectionOptionsReply *    reply,
  445.                                  Point                     where,
  446.                                  short                     expansionDITLresID,
  447.                                  ExpDlgHookUPP             dlgHook,
  448.                                  ExpModalFilterUPP         filter,
  449.                                  void *                    yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0B3C, 0xA82D);
  450.  
  451.  
  452. #if PRAGMA_STRUCT_ALIGN
  453.     #pragma options align=reset
  454. #elif PRAGMA_STRUCT_PACKPUSH
  455.     #pragma pack(pop)
  456. #elif PRAGMA_STRUCT_PACK
  457.     #pragma pack()
  458. #endif
  459.  
  460. #ifdef PRAGMA_IMPORT_OFF
  461. #pragma import off
  462. #elif PRAGMA_IMPORT
  463. #pragma import reset
  464. #endif
  465.  
  466. #ifdef __cplusplus
  467. }
  468. #endif
  469.  
  470. #endif /* __EDITIONS__ */
  471.  
  472.